#include "Global.h"
#include "objects.h"
#include "DynamicObjects.h"
#include "StaticObjects.h"
#include "Enemy.h"
#ifndef  _NODE_H
#define _NODE_H

#define  _Max 10;
#define  _MinWidth 400
#define  _MinHeight 400


using namespace std;
class CNode
{
private:
	CNode *TL, *TR, *BL, *BR;
	list<CNode*> *Content;
	list<CObjects*> *listObj;
	int Width, Height;
	bool IsFull;
	RECT Area;
	int Delta;
protected:
public:
	CNode(void);
	CNode(RECT);
	~CNode(void);
	void Insert(CObjects*);
	bool Distribute(CObjects*);
	void CreateChildNodes();
	void Draw(RECT);
	void GetObjectInScreen(list<CObjects*> *_list, RECT Screen);
	//void GetListOfList(list<list<CObjects*>*> *BigList);
	void DrawGame(list<CObjects*> *_list, RECT Screen);
	void Move(RECT Screen,CNode *_NodeRoot);
	bool CheckCollision(RECT RectObj);
	bool CheckCollisionNoE(RECT RectObj);
	bool CheckListCollision(RECT RectObj,list<CObjects*> *_ListCollision,bool &_KQ);
	//tool
	bool IsBound(RECT nho,RECT lon);
	bool IntersectRect(RECT rect1,RECT rect2);
	bool Intersect100(RECT rect1,RECT rect2);
	bool IntersectRectEnemy(RECT rect1,RECT rect2);
	RECT Overlap(RECT A,RECT B);
};

#endif